import requests
import json

url = "http://172.30.104.49/xgxt/xgxx/findByXh.action"

# query_str = input("请输入要翻译的内容：")

data = {
"xh": "1820043003"
}
# http://172.30.104.49/sys/yx/stu.do?method=getZPT&xh=学号
# data = {"query":"你好，世界",
#         "from":"zh",
#          "to":"en"}

# print(data)
headers = {
    # "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1",
    # "Referer": "https://www.baidu.com/link?url=uP_DNfCD3oj1OQm2MNcXxRTzWaprk9xAInplNvYn4P8qjkL8oRnDYR26knX0VefRnRCgAYPovcSNuN_ViyOflK&wd=&eqid=f814d8c700100088000000065cefc6b0",
    "cookie":"JSESSIONID=7FC2F96B74A1E4F4F9BC092796D3E955; pageNo=1; pageSize=5"
}

response = requests.post(url,data=data,headers=headers)

# print(response)

html_str = response.content.decode()  # json字符串
print(html_str)
dict_ret = json.loads(html_str)
print(dict_ret)
# print(type(dict_ret))
# ret = dict_ret["query"]
# print("翻译结果是：",ret)